﻿using System.Collections.Generic;
using Common.DTO;
using Database.Repositories;
using System;

namespace GameLogic.Place
{
    public class TileManager
    {
        private readonly TileRepository _tileRepostory;
        private readonly PlaceRepository _placeRepostory;

        public TileManager()
        {
            _tileRepostory = new TileRepository();
            _placeRepostory = new PlaceRepository();
        }

        public bool ChangeGameObject(TileDTO tileDTO)
        {
            throw new System.NotImplementedException();
        }

        public TileDTO MoveGameObject(TileDTO tileDTO)
        {
            return _tileRepostory.Update(tileDTO);
        }

        public List<TileDTO> GetTiles(Guid placeId)
        {
            var place = _placeRepostory.GetById(placeId);
            if (place == null)
                return null;

            return _tileRepostory.GetAllByPlace(place);
        }

        public bool CreateGameObject(TileDTO tileDTO)
        {
            var val = _tileRepostory.Create(tileDTO);
            return val > 0;
        }

    }
}
